package com.lzz.dubbo.util;

import com.alibaba.fastjson.JSONObject;
import java.lang.reflect.Type;


/**
 * @author: liuzhengzhong
 * @create: 2020/10/14 3:42 PM
 **/
public class MockValueResolver {

    public static Object resolve(String mockValue, Class<?> type, Type genericReturnType) {
        if (Void.TYPE.isAssignableFrom(type)) {
            return null;
        }
        Object value = JSONObject.parseObject(mockValue, genericReturnType==null?type:genericReturnType);
        return value;
    }

}
